package com.guochenglang.www.service;

import com.guochenglang.www.pojo.Traces;
import com.guochenglang.www.service.anotate.Affair;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface TracesService {
    /**
     * 获得浏览记录
     *
     * @param userId 用户id
     * @return 浏览记录
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<Traces> selectTraces(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 添加浏览记录
     *
     * @param traces 浏览记录的信息
     * @return 添加的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int insertTraces(Traces traces) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除浏览记录
     *
     * @param traceId 浏览记录id
     * @return 删除的行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteATraces(Integer traceId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除所有浏览记录
     *
     * @param userId 用户id
     * @return 删除的行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteAll(Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
